//
//  ViewController.m
//  网络部分
//
//  Created by song on 15/8/13.
//  Copyright (c) 2015年 song. All rights reserved.
//

#import "ViewController.h"
#import "ASIHTTPRequest.h"
#import  "ASIFormDataRequest.h"

@interface ViewController () <ASIHTTPRequestDelegate>

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
  
    
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    NSURL *url = [NSURL URLWithString:@"http://localhost/test.php"];
    ASIHTTPRequest *request =[ASIHTTPRequest requestWithURL:url];
    request.timeOutSeconds = 10;
    request.delegate = self;
    [request startSynchronous];
    
    if(request.error)
    {
        NSLog(@"请求出错  ----%@", request.error);
    }else{
        NSLog(@"%d --- %@" , request.responseStatusCode,request.responseStatusMessage);
        NSLog(@"response data is %@",[[NSString alloc] initWithData:request.responseData encoding:NSUTF8StringEncoding     ]);
        
    }
    
    
}

//-----------------------
// AFN 相关的操作
//-----------------------

-(void)AFNget
{
    
}


-(void)AFNPOST










///-------ASI 相关的操作-------------------------------

-(void) requestFinished:(ASIHTTPRequest *)request
{
    NSLog(@"------requestFinished");
}

-(void)requestFailed:(ASIHTTPRequest *)request
{
    NSLog(@"----requestFailed");
}



@end
